package com.zhss.eshop.order.service;

import com.zhss.eshop.order.domain.dto.OrderInfoDTO;
import com.zhss.eshop.order.domain.model.OrderInfo;
import com.zhss.eshop.promotion.domain.dto.PromotionCouponDTO;

public interface OrderInfoService{


    int deleteByPrimaryKey(Long id);

    OrderInfoDTO insertSelective(OrderInfoDTO record) throws Exception;

    OrderInfo selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(OrderInfo record);

    /**
     * 根据id查询订单
     * @param id 订单id
     * @return 订单
     * @throws Exception
     */
    OrderInfoDTO getById(Long id) throws Exception;

    /**
     * 计算订单价格
     * @param order 订单
     * @return 订单
     * @throws Exception
     */
    OrderInfoDTO calculateOrderPrice(OrderInfoDTO order) throws Exception;

    /**
     * 计算优惠券抵扣的金额
     * @param order 订单
     * @param coupon 优惠券
     * @return 抵扣金额
     * @throws Exception
     */
    OrderInfoDTO calculateCouponDiscountPrice(
            OrderInfoDTO order, PromotionCouponDTO coupon) throws Exception;

    /**
     * 取消订单
     * @param id 订单id
     * @return 处理结果
     * @throws Exception
     */
    Boolean cancel(Long id) throws Exception;

}
